﻿//Compressed image header
namespace Compression.ImageCompressor
{
    using System;    /// <summary>
    /// Header class
    /// </summary>
    [Serializable]
    public class ImageHeader
    {
        public ImageHeader()
        {
        }
        private UInt16 width,height,quantil,blocksize,deep;
        private bool offset, coloict;

        /// <summary>
        /// Width
        /// </summary>
        public UInt16 Width
        {
            get
            {
                return width;
            }
            set
            {
                width = value;
            }
        }

        /// <summary>
        /// Heigth
        /// </summary>
        public UInt16 Height
        {
            get
            {
                return height;
            }
            set
            {
                height = value;
            }
        }

        /// <summary>
        /// Quantilization coeff
        /// </summary>
        public UInt16 Quantilization
        {
            get
            {
                return quantil;
            }
            set
            {
                quantil = value;
            }
        }

        /// <summary>
        /// BlockSize
        /// </summary>
        public UInt16 BlockSize
        {
            get
            {
                return blocksize;
            }
            set
            {
                blocksize = value;
            }
        }

        /// <summary>
        /// Offset value
        /// </summary>
        public bool Offset
        {
            get
            {
                return offset;
            }
            set
            {
                offset = value;
            }
        }

        /// <summary>
        /// ICT or YUV color mole
        /// </summary>
        public bool ColorICT
        {
            get
            {
                return coloict;
            }
            set
            {
                coloict = value;
            }
        }

        /// <summary>
        /// Deep transformation
        /// </summary>
        public UInt16 Deep
        {
            get
            {
                return deep;
            }
            set
            {
                deep = value;
            }
        }

        /// <summary>
        /// Save Method
        /// </summary>
        /// <param name="worker"></param>
        public void SaveHeader(FileWorker worker)
        {
            worker.Write(width);
            worker.Write(height);
            worker.Write(quantil);
            worker.Write(blocksize);
            worker.Write(deep);
            worker.Write(offset);
            worker.Write(coloict);            
        }

        public void LoadHeader(FileWorker worker)
        {
            width = worker.ReadUInt16();
            height = worker.ReadUInt16();
            quantil = worker.ReadUInt16();
            blocksize = worker.ReadUInt16();
            deep = worker.ReadUInt16();
            offset = worker.ReadBoolean();
            coloict = worker.ReadBoolean();
        }
    }
}
